package com.fzb.forum4j.incp;

import org.apache.struts2.interceptor.ActionMappingParametersInteceptor;

import com.fzb.forum4j.controller.CommonsAction;
import com.fzb.forum4j.po.QueryMode;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;

public class AdminOperInterceptor extends ActionMappingParametersInteceptor{

 
	@SuppressWarnings("rawtypes")
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		((CommonsAction)ActionContext.getContext().getValueStack().getRoot().get(0)).prepare();
		invocation.getStack().push(((QueryMode)((CommonsAction)ActionContext.getContext().getValueStack().getRoot().get(0)).getModel()).getT());
		setParameters(invocation.getAction(), invocation.getStack(), invocation.getInvocationContext().getParameters());
		invocation.invokeActionOnly();
		invocation.getStack().push(((CommonsAction)invocation.getAction()).getData());
		return "json";
	}

 
}
